package com.test.ddd.domain.types;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @author csruan
 * @Copyright
 * @Description
 * @date 2021/9/10 16:51
 */
@Data
@NoArgsConstructor
public class QmPage<T> {
	private List<T> records;
	private long total;
	private long size;
	private long current;
	private long pages;

	public QmPage with(List<T> records, BasePageQuery query, long pages, long total) {
		return new QmPage(records, query.getPageNum(), query.getPageSize(), pages, total);
	}

	public QmPage(List<T> records, long current, long size, long pages, long total) {
		this.setRecords(records);
		this.setPages(pages);
		this.setCurrent(current);
		this.setSize(size);
		this.setTotal(total);
	}
}
